repo: Add _ostree_repo_get_remote_option_inherit()
authorMatthew Barnes <mbarnes@redhat.com>
Sat, 6 Jun 2015 19:52:44 +0000 (15:52 -0400)
committerGiuseppe Scrivano <gscrivan@redhat.com>
Fri, 26 Jun 2015 09:02:24 +0000 (11:02 +0200)
Split out from ostree-repo-pull.c.  Still private but more reusable now.

src/libostree/ostree-repo-private.h
src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo.c

index 0218315b6290658ab0eb3fea7a4965a5069f7022..b124e2276eb7e64f74505f4f39d8204fcc83a79b 100644 (file)
@@ -196,6 +196,13 @@ _ostree_repo_get_remote_boolean_option (OstreeRepo  *self,
                                         gboolean    *out_value,
                                         GError     **error);
 
+gboolean
+_ostree_repo_get_remote_option_inherit (OstreeRepo  *self,
+                                        const char  *remote_name,
+                                        const char  *option_name,
+                                        char       **out_value,
+                                        GError     **error);
+
 OstreeFetcher *
 _ostree_repo_remote_new_fetcher (OstreeRepo  *self,
                                  const char  *remote_name,
index 6a4f7d013d1a8975e2d18ae05c71a96b2bb88909..2a4281facc5d11dd4bf0c5ea8a3dfb5f53daf7c1 100644 (file)
@@ -1245,35 +1245,6 @@ enqueue_one_object_request (OtPullData        *pull_data,
   soup_uri_free (obj_uri);
 }
 
-static gboolean
-repo_get_remote_option_inherit (OstreeRepo  *self,
-                                const char  *remote_name,
-                                const char  *option_name,
-                                char       **out_value,
-                                GError     **error)
-{
-  OstreeRepo *parent = ostree_repo_get_parent (self);
-  g_autofree char *value = NULL;
-  gboolean ret = FALSE;
-
-  if (!_ostree_repo_get_remote_option (self, remote_name, option_name, NULL, &value, error))
-    goto out;
-
-  if (value == NULL && parent != NULL)
-    {
-        if (!repo_get_remote_option_inherit (parent, remote_name, option_name, &value, error))
-          goto out;
-    }
-
-  /* Success here just means no error occurred during lookup,
-   * not necessarily that we found a value for the option name. */
-  ot_transfer_out_value (out_value, &value);
-  ret = TRUE;
-
- out:
-  return ret;
-}
-
 static gboolean
 load_remote_repo_config (OtPullData    *pull_data,
                          GKeyFile     **out_keyfile,
@@ -1735,7 +1706,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
     {
       if (baseurl == NULL)
         {
-          if (!repo_get_remote_option_inherit (self, remote_name_or_baseurl, "url", &baseurl, error))
+          if (!_ostree_repo_get_remote_option_inherit (self, remote_name_or_baseurl, "url", &baseurl, error))
             goto out;
         }
 
index 5191e21c353f2699bcf5fbb43f5e531ef4de7384..2353ffac57618dabf2e1335de23e4b794f335a2a 100644 (file)
@@ -355,6 +355,41 @@ _ostree_repo_get_remote_boolean_option (OstreeRepo  *self,
   return ret;
 }
 
+gboolean
+_ostree_repo_get_remote_option_inherit (OstreeRepo  *self,
+                                        const char  *remote_name,
+                                        const char  *option_name,
+                                        char       **out_value,
+                                        GError     **error)
+{
+  OstreeRepo *parent = ostree_repo_get_parent (self);
+  g_autofree char *value = NULL;
+  gboolean ret = FALSE;
+
+  if (!_ostree_repo_get_remote_option (self,
+                                       remote_name, option_name,
+                                       NULL, &value, error))
+    goto out;
+
+  if (value == NULL && parent != NULL)
+    {
+      if (!_ostree_repo_get_remote_option_inherit (parent,
+                                                   remote_name, option_name,
+                                                   &value, error))
+        goto out;
+    }
+
+  /* Success here just means no error occurred during lookup,
+   * not necessarily that we found a value for the option name. */
+  if (out_value != NULL)
+    *out_value = g_steal_pointer (&value);
+
+  ret = TRUE;
+
+out:
+  return ret;
+}
+
 OstreeFetcher *
 _ostree_repo_remote_new_fetcher (OstreeRepo  *self,
                                  const char  *remote_name,